package com.edfu.core.coursemgt.persistence.entity;

import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

import com.edfu.core.commons.persistence.Discountable;
import com.edfu.core.commons.persistence.Sellable;
import com.edfu.core.commons.persistence.entity.CategoryEntity;

@Entity
@Table(name="course")
public class CourseEntity implements ICourseMgtEntity, Sellable, Discountable {
	private long id;
	private String name;
	private String code;
	private String description;
	private Date createdOn;
	private String courseCurriculum;
	private CategoryEntity category;
	private double price;    
    private String units;
    private String discType;
    private double discValue;
    private long discStart;
    private long discEnd;
	
	@Id
	@GeneratedValue(strategy=GenerationType.AUTO)
	public long getId() {
		return id;
	}
	public void setId(long id) {
		this.id = id;
	}
	public String getName() {
		return name;
	}
	public void setName(String name) {
		this.name = name;
	}
	public String getCode() {
		return code;
	}
	public void setCode(String code) {
		this.code = code;
	}
	public String getDescription() {
		return description;
	}
	public void setDescription(String description) {
		this.description = description;
	}
	public Date getCreatedOn() {
		return createdOn;
	}
	public void setCreatedOn(Date createdOn) {
		this.createdOn = createdOn;
	}
	public String getCourseCurriculum() {
		return courseCurriculum;
	}
	public void setCourseCurriculum(String courseCurriculum) {
		this.courseCurriculum = courseCurriculum;
	}
	
	@ManyToOne
	@JoinColumn(name="category_id", nullable=true)
	public CategoryEntity getCategory() {
		return category;
	}
	public void setCategory(CategoryEntity category) {
		this.category = category;
	}
	
	@Column(name = "price", nullable = true)
    public double getPrice() {
		return price;
	}
	public void setPrice(double price) {
		this.price = price;
	}
	
	@Column(name = "units", nullable = true)
	public String getUnits() {
		return units;
	}
	public void setUnits(String units) {
		this.units = units;
	}
	
	@Column(name = "discType", nullable = true)
	public String getDiscType() {
		return discType;
	}
	public void setDiscType(String discType) {
		this.discType = discType;
	}
	
	@Column(name = "discValue", nullable = true)
	public double getDiscValue() {
		return discValue;
	}
	public void setDiscValue(double discValue) {
		this.discValue = discValue;
	}
	
	@Column(name = "discStart", nullable = true)
	public long getDiscStart() {
		return discStart;
	}
	public void setDiscStart(long discStart) {
		this.discStart = discStart;
	}
	
	@Column(name = "discEnd", nullable = true)
	public long getDiscEnd() {
		return discEnd;
	}
	public void setDiscEnd(long discEnd) {
		this.discEnd = discEnd;
	}	
	
}
